﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WithDelegates
{
    public class ActionMenuItem : MenuItem
    {
        public event ClickEventHandler Click;

        public ActionMenuItem(int i_MenuItemLevel, string i_Name)
        {
            m_MenuItemLevel = i_MenuItemLevel;
            m_Name = m_CurrentMenuItemTitle = i_Name;
        }
        
        public override void OnClick()
        {
            if (Click != null)
            {
                System.Console.Clear();
                ShowTitle();
                Click.Invoke();
            }

            throw new MenuItemException(MenuItemException.eMenuItemMessage.ExecuteFinished);
        }
    }
}